package com.jeeni.tetrisproject;

public class TetrisBlock {
	public int[][] block;
	public int blockSize;
	public int blockSpace;
	public int blockX = 0;
	public int blockY = 0;
	
	public TetrisBlock(int[][] _block, int size, int space)
	{
		block = _block.clone();
		blockSize = size;
		blockSpace = space;
	}
	
	public void moveBlock(int x, int y)
	{
		blockX = x; blockY = y;
	}
	
	public void rotateBlock(boolean moveLeft)
	{
		int[][] _block = new int[blockSize][blockSize];
		
		if(moveLeft)
		{
			for(int y = 0; y < blockSize; y++)
			{
				for(int x =0; x < blockSize; x++)
				{
					_block[blockSize-x-1][y] = block[y][x];
				}
			}
		}else{
			for(int y = 0; y < blockSize; y++)
			{
				for(int x =0; x < blockSize; x++)
				{
					_block[x][blockSize-y-1] = block[y][x];
				}
			}
		}
		
		block = _block;
	}
}
